const express=require('express')
const lodash=require('lodash')
const cors=require('cors')
const app=express()
const {arr}=require('./stuName')
console.log(arr);
app.use(cors())//解决同源策略,支持跨域
//请求监听
app.get('/api/rand',(req,res)=>{
  const rand=lodash.random(1,10)
  res.send(arr[rand])
})
//监听服务器是否开启
app.listen(33345,()=>{
  console.log('http://127.0.0.1:33345/api/rand');
})